package com.woniu.exception;

import com.woniu.exception.DIYException;
import com.woniu.util.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;

public class AllException {
    @ExceptionHandler(DIYException.class)
    public Result<?> handleException(DIYException e){
        e.printStackTrace();
        return Result.bulid().setFlag(false).setCode(e.getCode()).setMessage(e.getMessage());
    }

    //兜底异常类
    @ExceptionHandler(Exception.class)
    public Result<?> handleException(Exception e){
        e.printStackTrace();
        return Result.bulid().setFlag(false).setCode(-500).setMessage("服务器异常");
    }
}
